package backend;

import sun.reflect.generics.reflectiveObjects.NotImplementedException;

public class Fact
{
	
	private int factId;
	private int timeId;
	private int dateId;
	private int bagId;
	private int locationId;
	private int factDuration;
	private boolean factStatus; // This will be TRUE if the bag is LOST!
	
	private Location actualLocation = null;
	private DateTime actualDateTime = null;
	
	private Warehouse wh;
	
	public Fact(Warehouse whIn, int fId, int tId, int dId, int b, int l, int d, boolean s)
	{
		factId = fId;
		timeId = tId;
		dateId = dId;
		bagId = b;
		locationId = l;
		factDuration = d;
		factStatus = s;
		wh = whIn;
	}
	
	public int getFactId() {
		return factId;
	}
	
	public void setFactId(int id) {
		factId = id;
	}

	public int getTimeId() {
		return timeId;
	}
	
	public int getDateId() {
		return dateId;
	}
	
	public int getBagId() {
		return bagId;
	}

	public int getLocationId() {
		return locationId;
	}

	public int getDuration() {
		return factDuration;
	}

	public boolean getStatus() {
		return factStatus;
	}
	
	public void setDuration(int newDuration)
	{
		factDuration = newDuration;
	}

	public Location getLocation()
	{
		if (actualLocation == null)
		{
			actualLocation = wh.getLocation(locationId);
		}
		return actualLocation;
	}

	public DateTime getDateTime()
	{
		if (actualDateTime == null)
		{
			actualDateTime = wh.getDateTime(dateId, timeId);
		}
		return actualDateTime;
	}
	
}
